package cn.nuc.edu.onlinestore.entity;

import java.util.Date;

/**
 * 商品
 * 
 * @author 王凯
 *
 */
public class Goods {

	/**
	 * 货物id
	 */
	private Integer gid;

	/**
	 * 货物名称
	 */
	private String gname;

	/**
	 * 库存
	 */
	private Integer gcount;

	/**
	 * 单价
	 */
	private Float gprice;

	/**
	 * 描述
	 */
	private String gdesc;

	/**
	 * 商品图片URL
	 */
	private String gimg;

	/**
	 * 商品状态 0：已录入但未上架 1：已录入并已上架 -1：下架
	 */
	private Integer goodsstate;

	/**
	 * 消费金额
	 */
	private Double buycost;

	/**
	 * 消费时间
	 */
	private Date buytime;
	
	/**
	 * 购买人
	 */
	private String consumer;

	public Integer getGid() {
		return gid;
	}

	public void setGid(Integer gid) {
		this.gid = gid;
	}

	public String getGname() {
		return gname;
	}

	public void setGname(String gname) {
		this.gname = gname;
	}

	public Integer getGcount() {
		return gcount;
	}

	public void setGcount(Integer gcount) {
		this.gcount = gcount;
	}

	public Float getGprice() {
		return gprice;
	}

	public void setGprice(Float gprice) {
		this.gprice = gprice;
	}

	public String getGdesc() {
		return gdesc;
	}

	public void setGdesc(String gdesc) {
		this.gdesc = gdesc;
	}

	public String getGimg() {
		return gimg;
	}

	public void setGimg(String gimg) {
		this.gimg = gimg;
	}

	public Integer getGoodsstate() {
		return goodsstate;
	}

	public void setGoodsstate(Integer goodsstate) {
		this.goodsstate = goodsstate;
	}

	public Double getBuycost() {
		return buycost;
	}

	public void setBuycost(Double buycost) {
		this.buycost = buycost;
	}

	public Date getBuytime() {
		return buytime;
	}

	public void setBuytime(Date buytime) {
		this.buytime = buytime;
	}
	
	public String getConsumer() {
		return consumer;
	}
	
	public void setConsumer(String consumer) {
		this.consumer = consumer;
	}

	@Override
	public String toString() {
		return "Goods [gid=" + gid + ", gname=" + gname + ", gcount=" + gcount + ", gprice=" + gprice + ", gdesc="
				+ gdesc + ", gimg=" + gimg + ", goodsstate=" + goodsstate + ", buycost=" + buycost + ", buytime="
				+ buytime + ", consumer=" + consumer + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((gid == null) ? 0 : gid.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Goods other = (Goods) obj;
		if (gid == null) {
			if (other.gid != null)
				return false;
		} else if (!gid.equals(other.gid))
			return false;
		return true;
	}
	
}
